from utils.singleCard import Card, HandCard, PoolCard
from utils.sult import suit
import random
from typing import List
_sult = suit.keys()


# type Group []Card
class Group:
    INIT_VALUE = "00000"

    def __init__(self, *args):
        self.interior = []
        for card in args:
            self.interior.append(card)

    @property
    def _type(self):
        "判断牌型"
        return 'pass'


class Volume:
    def __init__(self):
        self.collection = []


class Player(Volume): ...


class Pool(Volume): ...


# type OriginCard []Card
class OriginCard:
    def __init__(self):
        self.collection = []  # 一套完整的牌
        for i in _sult:
            for j in ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']:
                self.collection.append(Card(j, i))
        random.shuffle(self.collection)  # 洗一下牌

    def __repr__(self):
        res = []
        for i in self.collection:
            res.append('-'.join([i.No, i.sult.logo, ]))
        return ','.join(res)

    # 发牌
    def faPai(self, ps:List[Player],pool:Pool):
        # 发给玩家
        for i in ps:
            i.collection.append(self.collection.pop())

        # 发到池子
        for _ in range(3):
            pool.collection.append(self.collection.pop())

if __name__ == '__main__':
    a = Card('5', 'Heart')
    b = HandCard('7', 'Heart')
    c = Card('8', 'Heart')
    g = Group(a, b, c)
    print(isinstance(b, PoolCard))
    print(g.interior)
    o = OriginCard()
    print(o)
